<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>
<%@page import="com.feib.soeasy.util.CodeTableUtil"%>
<%@page import="com.feib.soeasy.model.UploadFile"%>

<script type="text/javascript">
	<!--	
	$(document).ready(function() {	
		
		$('#printBtn2003').click(function() {
			//window.print();
			//doQueryPrintAction();
			divPrint('paymentListDiv');//只印目前這筆
		});
		
		
		$("[id^='viewPaymentImg-']").click(function() {
			var uploadFilePk = this.id.substring(15);
			
			doQueryPaymentsAction(uploadFilePk);
			
		});	

		$("[id^='passBatchUploadFileBtn']").click(function() {
			doUploadFileConfirmAction(9);
		});
		$("[id^='cancelBatchUploadFileBtn']").click(function() {
			doUploadFileConfirmAction(5);
		});

		$("#checkAll").click(function() {
			doCheckAll();
		});
		$("#unCheckAll").click(function() {
			undoCheckAll();
		});
		
	});
	
	//-->
	</script>
	
<c:choose>
	<c:when test="${null != actionBean.queryResult && not empty actionBean.queryResult.paginatedList}">
	<stripes:form name="confirmHiddenFrom" id="confirmHiddenFrom" beanclass="com.feib.soeasy.action.Soez2003ActionBean" 
		method="post" onsubmit="javascript: return false;">	
		<table id="listTable">
			<thead>
				<tr>
					<th>&nbsp;</th>
					<th>上傳日期</th>
					<th>檔案名稱</th>
					<th>上傳格式</th>
					<th>上傳人員</th>
					<th>總筆數</th>
					<th>總金額</th>
					<%if ( UserUtil.isBankGroup()){ %>
					<th>業者名稱</th>
					<%} %>
					<th>&nbsp;</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${actionBean.queryResult.paginatedList}" var="viewObj" varStatus="rowstat">
				<tr>
					<td align="center">
						<input name="checkUploadFiles[${rowstat.index}].uploadFilePk" 
							type="checkbox" 
							id="checkUploadFiles[${rowstat.index}].uploadFilePk" 
							value="<c:out value='${viewObj.uploadFilePk}'/>" class="chk"/>
					</td>
					<td align="center"><fmt:formatDate value="${viewObj.uploadDate}" pattern="yyyy/MM/dd" /><br/>
						<fmt:formatDate value="${viewObj.uploadDate}" pattern="HH:mm:ss" />
					</td>
					<td><c:out value="${viewObj.fileName}"/></td>
					<td><c:out value="${viewObj.formatDefinition.formatName}"/></td>
					<td>
						<c:choose>
							<c:when test="${null != viewObj.uploadUser }"><c:out value="${viewObj.uploadUser.userName}"/></c:when>
							<c:otherwise>&nbsp;</c:otherwise>
						</c:choose>
					</td> 
					<td align="right"><fmt:formatNumber value="${viewObj.totalItems}" pattern="##,###" /></td>
					<td align="right"><fmt:formatNumber value="${viewObj.totalAmount}" pattern="##,###" /></td>
					<%if ( UserUtil.isBankGroup()){ %>
					<td><c:out value="${viewObj.group.groupName}" /></td>
					<%} %>
					<td>
						<div id="viewPaymentImg-<c:out value='${viewObj.uploadFilePk}'/>"><a href="javascript: void(0)" class="btnZoom">查詢</a></div>
					</td>					
				</tr>
				</c:forEach>
			</tbody>
		</table>
	<input type="hidden" id="method" name="doAjaxBatchUploadFileConfirm"/>
	<stripes:hidden id="hidden.qryUploadFile.fileStatus" name="qryUploadFile.fileStatus"/>
		<div id="paginationBar" align="center">
		
			<input type="button" 
				id="checkAll" name="checkAll" 
				value="全選">
			<input type="button" 
				id="unCheckAll" name="unCheckAll" 
				value="全不選">
							
			<input type="button" 
				id="passBatchUploadFileBtn" 
				name="passBatchUploadFileBtn" 
				value="放行">
			<input type="button" 
				id="cancelBatchUploadFileBtn" 
				name="cancelBatchUploadFileBtn" 
				value="退件">
				<input type="button" id="printBtn2003" value="列印" />	
				
				
		</div>
	</stripes:form>
	</c:when>
	<c:otherwise>
		<div id="queryNothingBlockDiv" style="display: none;">
			查無資料
		</div>		
		<script type="text/javascript">
		<!--
		$(document).ready(function() {
			$( "#queryNothingBlockDiv" ).dialog( "destroy" );
			$( "#queryNothingBlockDiv" ).dialog({  title:'<%=UserUtil.getCurrentMenuItemName() %>查詢' ,width: 300, resizable: false, modal: true, buttons : {
				Ok : function() {
					$(this).dialog("close");
				}
			}  });
		});
		//-->
		</script>
	</c:otherwise>
</c:choose>
